<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
    <%@ page import="com.base.day9.ProductService"%>
    <%@ page import="java.util.ArrayList"%>
    <%@ page import="com.base.day9.Product"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>产品列表</title>

<meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/popper.js/1.12.5/umd/popper.min.js"></script>
  <script src="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/js/bootstrap.min.js"></script>
</head>
<body style="height:1500px">

<%
  String username=(String)session.getAttribute("uname");
%>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
  <a class="navbar-brand" href="#">Logo</a>
  <ul class="navbar-nav">
    <li class="nav-item">
      <a class="nav-link" href="#">Link</a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="#">Link</a>
    </li>
    
    <li class="nav-item" style="margin-left:1500px">
      <p class="navbar-brand">欢迎 <%=username %></p>
    </li>
    
     <li class="nav-item">
      <a class="nav-link" href="login.html">退出</a>
    </li>
    
    
  </ul>
   
</nav>

<div class="container-fluid" style="margin-top:80px">
  
  <div class="container">
  <h2>产品列表</h2>
  <div class="table-responsive">       
  <table class="table table-striped table-bordered table-hover">
    <thead>
      <tr>
        <th>产品编号</th>
        <th>名字</th>
        <th>类型</th>
        <th>价钱</th>
      </tr>
    </thead>
    <tbody>
    <%
    ProductService ps=new ProductService();
    ArrayList ls=ps.selectAll();
    for(int i=0;i<ls.size();i++){
    	Product p=(Product)ls.get(i);
    
    %>
      <tr>
        <td><%=p.getId() %></td>
        <td><%=p.getName() %></td>
        <td><%=p.getCategory() %></td>
        <td><%=p.getPrice() %></td>
      </tr>
      <% }%>
    </tbody>
  </table>
  </div>
</div>
  
</div>




</body>
</html>